home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / lispref.info-24.z / lispref.info-24
Encoding:
GNU Info File  |  1998-05-21  |  50.2 KB  |  1,194 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo version
  2. 1.68 from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
  12. Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
  13. Reference Manual (for 19.15 and 20.1, 20.2) v3.2, April, May 1997
  14.  
  15.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  16. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  17. Copyright (C) 1995, 1996 Ben Wing.
  18.  
  19.    Permission is granted to make and distribute verbatim copies of this
  20. manual provided the copyright notice and this permission notice are
  21. preserved on all copies.
  22.  
  23.    Permission is granted to copy and distribute modified versions of
  24. this manual under the conditions for verbatim copying, provided that the
  25. entire resulting derived work is distributed under the terms of a
  26. permission notice identical to this one.
  27.  
  28.    Permission is granted to copy and distribute translations of this
  29. manual into another language, under the above conditions for modified
  30. versions, except that this permission notice may be stated in a
  31. translation approved by the Foundation.
  32.  
  33.    Permission is granted to copy and distribute modified versions of
  34. this manual under the conditions for verbatim copying, provided also
  35. that the section entitled "GNU General Public License" is included
  36. exactly as in the original, and provided that the entire resulting
  37. derived work is distributed under the terms of a permission notice
  38. identical to this one.
  39.  
  40.    Permission is granted to copy and distribute translations of this
  41. manual into another language, under the above conditions for modified
  42. versions, except that the section entitled "GNU General Public License"
  43. may be included in a translation approved by the Free Software
  44. Foundation instead of in the original English.
  45.  
  46. 
  47. File: lispref.info,  Node: Buffer Modification,  Next: Modification Time,  Prev: Buffer File Name,  Up: Buffers
  48.  
  49. Buffer Modification
  50. ===================
  51.  
  52.    XEmacs keeps a flag called the "modified flag" for each buffer, to
  53. record whether you have changed the text of the buffer.  This flag is
  54. set to `t' whenever you alter the contents of the buffer, and cleared
  55. to `nil' when you save it.  Thus, the flag shows whether there are
  56. unsaved changes.  The flag value is normally shown in the modeline
  57. (*note Modeline Variables::.), and controls saving (*note Saving
  58. Buffers::.) and auto-saving (*note Auto-Saving::.).
  59.  
  60.    Some Lisp programs set the flag explicitly.  For example, the
  61. function `set-visited-file-name' sets the flag to `t', because the text
  62. does not match the newly-visited file, even if it is unchanged from the
  63. file formerly visited.
  64.  
  65.    The functions that modify the contents of buffers are described in
  66. *Note Text::.
  67.  
  68.  - Function: buffer-modified-p &optional BUFFER
  69.      This function returns `t' if the buffer BUFFER has been modified
  70.      since it was last read in from a file or saved, or `nil'
  71.      otherwise.  If BUFFER is not supplied, the current buffer is
  72.      tested.
  73.  
  74.  - Function: set-buffer-modified-p FLAG
  75.      This function marks the current buffer as modified if FLAG is
  76.      non-`nil', or as unmodified if the flag is `nil'.
  77.  
  78.      Another effect of calling this function is to cause unconditional
  79.      redisplay of the modeline for the current buffer.  In fact, the
  80.      function `redraw-modeline' works by doing this:
  81.  
  82.           (set-buffer-modified-p (buffer-modified-p))
  83.  
  84.  - Command: not-modified &optional ARG
  85.      This command marks the current buffer as unmodified, and not
  86.      needing to be saved. (If ARG is non-`nil', the buffer is instead
  87.      marked as modified.) Don't use this function in programs, since it
  88.      prints a message in the echo area; use `set-buffer-modified-p'
  89.      (above) instead.
  90.  
  91.  - Function: buffer-modified-tick &optional BUFFER
  92.      This function returns BUFFER`s modification-count.  This is a
  93.      counter that increments every time the buffer is modified.  If
  94.      BUFFER is `nil' (or omitted), the current buffer is used.
  95.  
  96. 
  97. File: lispref.info,  Node: Modification Time,  Next: Read Only Buffers,  Prev: Buffer Modification,  Up: Buffers
  98.  
  99. Comparison of Modification Time
  100. ===============================
  101.  
  102.    Suppose that you visit a file and make changes in its buffer, and
  103. meanwhile the file itself is changed on disk.  At this point, saving the
  104. buffer would overwrite the changes in the file.  Occasionally this may
  105. be what you want, but usually it would lose valuable information.
  106. XEmacs therefore checks the file's modification time using the functions
  107. described below before saving the file.
  108.  
  109.  - Function: verify-visited-file-modtime BUFFER
  110.      This function compares what BUFFER has recorded for the
  111.      modification time of its visited file against the actual
  112.      modification time of the file as recorded by the operating system.
  113.      The two should be the same unless some other process has written
  114.      the file since XEmacs visited or saved it.
  115.  
  116.      The function returns `t' if the last actual modification time and
  117.      XEmacs's recorded modification time are the same, `nil' otherwise.
  118.  
  119.  - Function: clear-visited-file-modtime
  120.      This function clears out the record of the last modification time
  121.      of the file being visited by the current buffer.  As a result, the
  122.      next attempt to save this buffer will not complain of a
  123.      discrepancy in file modification times.
  124.  
  125.      This function is called in `set-visited-file-name' and other
  126.      exceptional places where the usual test to avoid overwriting a
  127.      changed file should not be done.
  128.  
  129.  - Function: visited-file-modtime
  130.      This function returns the buffer's recorded last file modification
  131.      time, as a list of the form `(HIGH . LOW)'.  (This is the same
  132.      format that `file-attributes' uses to return time values; see
  133.      *Note File Attributes::.)
  134.  
  135.  - Function: set-visited-file-modtime &optional TIME
  136.      This function updates the buffer's record of the last modification
  137.      time of the visited file, to the value specified by TIME if TIME
  138.      is not `nil', and otherwise to the last modification time of the
  139.      visited file.
  140.  
  141.      If TIME is not `nil', it should have the form `(HIGH . LOW)' or
  142.      `(HIGH LOW)', in either case containing two integers, each of
  143.      which holds 16 bits of the time.
  144.  
  145.      This function is useful if the buffer was not read from the file
  146.      normally, or if the file itself has been changed for some known
  147.      benign reason.
  148.  
  149.  - Function: ask-user-about-supersession-threat FILENAME
  150.      This function is used to ask a user how to proceed after an
  151.      attempt to modify an obsolete buffer visiting file FILENAME.  An
  152.      "obsolete buffer" is an unmodified buffer for which the associated
  153.      file on disk is newer than the last save-time of the buffer.  This
  154.      means some other program has probably altered the file.
  155.  
  156.      Depending on the user's answer, the function may return normally,
  157.      in which case the modification of the buffer proceeds, or it may
  158.      signal a `file-supersession' error with data `(FILENAME)', in which
  159.      case the proposed buffer modification is not allowed.
  160.  
  161.      This function is called automatically by XEmacs on the proper
  162.      occasions.  It exists so you can customize XEmacs by redefining it.
  163.      See the file `userlock.el' for the standard definition.
  164.  
  165.      See also the file locking mechanism in *Note File Locks::.
  166.  
  167. 
  168. File: lispref.info,  Node: Read Only Buffers,  Next: The Buffer List,  Prev: Modification Time,  Up: Buffers
  169.  
  170. Read-Only Buffers
  171. =================
  172.  
  173.    If a buffer is "read-only", then you cannot change its contents,
  174. although you may change your view of the contents by scrolling and
  175. narrowing.
  176.  
  177.    Read-only buffers are used in two kinds of situations:
  178.  
  179.    * A buffer visiting a write-protected file is normally read-only.
  180.  
  181.      Here, the purpose is to show the user that editing the buffer with
  182.      the aim of saving it in the file may be futile or undesirable.
  183.      The user who wants to change the buffer text despite this can do
  184.      so after clearing the read-only flag with `C-x C-q'.
  185.  
  186.    * Modes such as Dired and Rmail make buffers read-only when altering
  187.      the contents with the usual editing commands is probably a mistake.
  188.  
  189.      The special commands of these modes bind `buffer-read-only' to
  190.      `nil' (with `let') or bind `inhibit-read-only' to `t' around the
  191.      places where they change the text.
  192.  
  193.  - Variable: buffer-read-only
  194.      This buffer-local variable specifies whether the buffer is
  195.      read-only.  The buffer is read-only if this variable is non-`nil'.
  196.  
  197.  - Variable: inhibit-read-only
  198.      If this variable is non-`nil', then read-only buffers and read-only
  199.      characters may be modified.  Read-only characters in a buffer are
  200.      those that have non-`nil' `read-only' properties (either text
  201.      properties or extent properties).  *Note Extent Properties::, for
  202.      more information about text properties and extent properties.
  203.  
  204.      If `inhibit-read-only' is `t', all `read-only' character
  205.      properties have no effect.  If `inhibit-read-only' is a list, then
  206.      `read-only' character properties have no effect if they are members
  207.      of the list (comparison is done with `eq').
  208.  
  209.  - Command: toggle-read-only
  210.      This command changes whether the current buffer is read-only.  It
  211.      is intended for interactive use; don't use it in programs.  At any
  212.      given point in a program, you should know whether you want the
  213.      read-only flag on or off; so you can set `buffer-read-only'
  214.      explicitly to the proper value, `t' or `nil'.
  215.  
  216.  - Function: barf-if-buffer-read-only
  217.      This function signals a `buffer-read-only' error if the current
  218.      buffer is read-only.  *Note Interactive Call::, for another way to
  219.      signal an error if the current buffer is read-only.
  220.  
  221. 
  222. File: lispref.info,  Node: The Buffer List,  Next: Creating Buffers,  Prev: Read Only Buffers,  Up: Buffers
  223.  
  224. The Buffer List
  225. ===============
  226.  
  227.    The "buffer list" is a list of all live buffers.  Creating a buffer
  228. adds it to this list, and killing a buffer deletes it.  The order of
  229. the buffers in the list is based primarily on how recently each buffer
  230. has been displayed in the selected window.  Buffers move to the front
  231. of the list when they are selected and to the end when they are buried.
  232. Several functions, notably `other-buffer', use this ordering.  A
  233. buffer list displayed for the user also follows this order.
  234.  
  235.    Every frame has its own order for the buffer list.  Switching to a
  236. new buffer inside of a particular frame changes the buffer list order
  237. for that frame, but does not affect the buffer list order of any other
  238. frames.  In addition, there is a global, non-frame buffer list order
  239. that is independent of the buffer list orders for any particular frame.
  240.  
  241.    Note that the different buffer lists all contain the same elements.
  242. It is only the order of those elements that is different.
  243.  
  244.  - Function: buffer-list &optional FRAME
  245.      This function returns a list of all buffers, including those whose
  246.      names begin with a space.  The elements are actual buffers, not
  247.      their names.  The order of the list is specific to FRAME, which
  248.      defaults to the current frame.  If FRAME is `t', the global,
  249.      non-frame ordering is returned instead.
  250.  
  251.           (buffer-list)
  252.                => (#<buffer buffers.texi>
  253.                    #<buffer  *Minibuf-1*> #<buffer buffer.c>
  254.                    #<buffer *Help*> #<buffer TAGS>)
  255.           
  256.           ;; Note that the name of the minibuffer
  257.           ;;   begins with a space!
  258.           (mapcar (function buffer-name) (buffer-list))
  259.               => ("buffers.texi" " *Minibuf-1*"
  260.                   "buffer.c" "*Help*" "TAGS")
  261.  
  262.      Buffers appear earlier in the list if they were current more
  263.      recently.
  264.  
  265.      This list is a copy of a list used inside XEmacs; modifying it has
  266.      no effect on the buffers.
  267.  
  268.  - Function: other-buffer &optional BUFFER-OR-NAME FRAME VISIBLE-OK
  269.      This function returns the first buffer in the buffer list other
  270.      than BUFFER-OR-NAME, in FRAME's ordering for the buffer list.
  271.      (FRAME defaults to the current frame.  If FRAME is `t', then the
  272.      global, non-frame ordering is used.) Usually this is the buffer
  273.      most recently shown in the selected window, aside from
  274.      BUFFER-OR-NAME.  Buffers are moved to the front of the list when
  275.      they are selected and to the end when they are buried.  Buffers
  276.      whose names start with a space are not considered.
  277.  
  278.      If BUFFER-OR-NAME is not supplied (or if it is not a buffer), then
  279.      `other-buffer' returns the first buffer on the buffer list that is
  280.      not visible in any window in a visible frame.
  281.  
  282.      If the selected frame has a non-`nil' `buffer-predicate' property,
  283.      then `other-buffer' uses that predicate to decide which buffers to
  284.      consider.  It calls the predicate once for each buffer, and if the
  285.      value is `nil', that buffer is ignored.  *Note X Frame
  286.      Properties::.
  287.  
  288.      If VISIBLE-OK is `nil', `other-buffer' avoids returning a buffer
  289.      visible in any window on any visible frame, except as a last
  290.      resort.   If VISIBLE-OK is non-`nil', then it does not matter
  291.      whether a buffer is displayed somewhere or not.
  292.  
  293.      If no suitable buffer exists, the buffer `*scratch*' is returned
  294.      (and created, if necessary).
  295.  
  296.      Note that in FSF Emacs 19, there is no FRAME argument, and
  297.      VISIBLE-OK is the second argument instead of the third.  FSF Emacs
  298.      19.
  299.  
  300.  - Command: list-buffers &optional FILES-ONLY
  301.      This function displays a listing of the names of existing buffers.
  302.      It clears the buffer `*Buffer List*', then inserts the listing
  303.      into that buffer and displays it in a window.  `list-buffers' is
  304.      intended for interactive use, and is described fully in `The XEmacs
  305.      Reference Manual'.  It returns `nil'.
  306.  
  307.  - Command: bury-buffer &optional BUFFER-OR-NAME
  308.      This function puts BUFFER-OR-NAME at the end of the buffer list
  309.      without changing the order of any of the other buffers on the list.
  310.      This buffer therefore becomes the least desirable candidate for
  311.      `other-buffer' to return.
  312.  
  313.      If BUFFER-OR-NAME is `nil' or omitted, this means to bury the
  314.      current buffer.  In addition, if the buffer is displayed in the
  315.      selected window, this switches to some other buffer (obtained using
  316.      `other-buffer') in the selected window.  But if the buffer is
  317.      displayed in some other window, it remains displayed there.
  318.  
  319.      If you wish to replace a buffer in all the windows that display
  320.      it, use `replace-buffer-in-windows'.  *Note Buffers and Windows::.
  321.  
  322. 
  323. File: lispref.info,  Node: Creating Buffers,  Next: Killing Buffers,  Prev: The Buffer List,  Up: Buffers
  324.  
  325. Creating Buffers
  326. ================
  327.  
  328.    This section describes the two primitives for creating buffers.
  329. `get-buffer-create' creates a buffer if it finds no existing buffer
  330. with the specified name; `generate-new-buffer' always creates a new
  331. buffer and gives it a unique name.
  332.  
  333.    Other functions you can use to create buffers include
  334. `with-output-to-temp-buffer' (*note Temporary Displays::.) and
  335. `create-file-buffer' (*note Visiting Files::.).  Starting a subprocess
  336. can also create a buffer (*note Processes::.).
  337.  
  338.  - Function: get-buffer-create NAME
  339.      This function returns a buffer named NAME.  It returns an existing
  340.      buffer with that name, if one exists; otherwise, it creates a new
  341.      buffer.  The buffer does not become the current buffer--this
  342.      function does not change which buffer is current.
  343.  
  344.      An error is signaled if NAME is not a string.
  345.  
  346.           (get-buffer-create "foo")
  347.                => #<buffer foo>
  348.  
  349.      The major mode for the new buffer is set to Fundamental mode.  The
  350.      variable `default-major-mode' is handled at a higher level.  *Note
  351.      Auto Major Mode::.
  352.  
  353.  - Function: generate-new-buffer NAME
  354.      This function returns a newly created, empty buffer, but does not
  355.      make it current.  If there is no buffer named NAME, then that is
  356.      the name of the new buffer.  If that name is in use, this function
  357.      adds suffixes of the form `<N>' to NAME, where N is an integer.
  358.      It tries successive integers starting with 2 until it finds an
  359.      available name.
  360.  
  361.      An error is signaled if NAME is not a string.
  362.  
  363.           (generate-new-buffer "bar")
  364.                => #<buffer bar>
  365.           (generate-new-buffer "bar")
  366.                => #<buffer bar<2>>
  367.           (generate-new-buffer "bar")
  368.                => #<buffer bar<3>>
  369.  
  370.      The major mode for the new buffer is set to Fundamental mode.  The
  371.      variable `default-major-mode' is handled at a higher level.  *Note
  372.      Auto Major Mode::.
  373.  
  374.      See the related function `generate-new-buffer-name' in *Note
  375.      Buffer Names::.
  376.  
  377. 
  378. File: lispref.info,  Node: Killing Buffers,  Next: Indirect Buffers,  Prev: Creating Buffers,  Up: Buffers
  379.  
  380. Killing Buffers
  381. ===============
  382.  
  383.    "Killing a buffer" makes its name unknown to XEmacs and makes its
  384. text space available for other use.
  385.  
  386.    The buffer object for the buffer that has been killed remains in
  387. existence as long as anything refers to it, but it is specially marked
  388. so that you cannot make it current or display it.  Killed buffers retain
  389. their identity, however; two distinct buffers, when killed, remain
  390. distinct according to `eq'.
  391.  
  392.    If you kill a buffer that is current or displayed in a window, XEmacs
  393. automatically selects or displays some other buffer instead.  This means
  394. that killing a buffer can in general change the current buffer.
  395. Therefore, when you kill a buffer, you should also take the precautions
  396. associated with changing the current buffer (unless you happen to know
  397. that the buffer being killed isn't current).  *Note Current Buffer::.
  398.  
  399.    If you kill a buffer that is the base buffer of one or more indirect
  400. buffers, the indirect buffers are automatically killed as well.
  401.  
  402.    The `buffer-name' of a killed buffer is `nil'.  To test whether a
  403. buffer has been killed, you can either use this feature or the function
  404. `buffer-live-p'.
  405.  
  406.  - Function: buffer-live-p BUFFER
  407.      This function returns `nil' if BUFFER is deleted, and `t'
  408.      otherwise.
  409.  
  410.  - Command: kill-buffer BUFFER-OR-NAME
  411.      This function kills the buffer BUFFER-OR-NAME, freeing all its
  412.      memory for use as space for other buffers.  (Emacs version 18 and
  413.      older was unable to return the memory to the operating system.)
  414.      It returns `nil'.
  415.  
  416.      Any processes that have this buffer as the `process-buffer' are
  417.      sent the `SIGHUP' signal, which normally causes them to terminate.
  418.      (The basic meaning of `SIGHUP' is that a dialup line has been
  419.      disconnected.)  *Note Deleting Processes::.
  420.  
  421.      If the buffer is visiting a file and contains unsaved changes,
  422.      `kill-buffer' asks the user to confirm before the buffer is killed.
  423.      It does this even if not called interactively.  To prevent the
  424.      request for confirmation, clear the modified flag before calling
  425.      `kill-buffer'.  *Note Buffer Modification::.
  426.  
  427.      Killing a buffer that is already dead has no effect.
  428.  
  429.           (kill-buffer "foo.unchanged")
  430.                => nil
  431.           (kill-buffer "foo.changed")
  432.           
  433.           ---------- Buffer: Minibuffer ----------
  434.           Buffer foo.changed modified; kill anyway? (yes or no) yes
  435.           ---------- Buffer: Minibuffer ----------
  436.           
  437.                => nil
  438.  
  439.  - Variable: kill-buffer-query-functions
  440.      After confirming unsaved changes, `kill-buffer' calls the functions
  441.      in the list `kill-buffer-query-functions', in order of appearance,
  442.      with no arguments.  The buffer being killed is the current buffer
  443.      when they are called.  The idea is that these functions ask for
  444.      confirmation from the user for various nonstandard reasons.  If
  445.      any of them returns `nil', `kill-buffer' spares the buffer's life.
  446.  
  447.  - Variable: kill-buffer-hook
  448.      This is a normal hook run by `kill-buffer' after asking all the
  449.      questions it is going to ask, just before actually killing the
  450.      buffer.  The buffer to be killed is current when the hook
  451.      functions run.  *Note Hooks::.
  452.  
  453.  - Variable: buffer-offer-save
  454.      This variable, if non-`nil' in a particular buffer, tells
  455.      `save-buffers-kill-emacs' and `save-some-buffers' to offer to save
  456.      that buffer, just as they offer to save file-visiting buffers.  The
  457.      variable `buffer-offer-save' automatically becomes buffer-local
  458.      when set for any reason.  *Note Buffer-Local Variables::.
  459.  
  460. 
  461. File: lispref.info,  Node: Indirect Buffers,  Prev: Killing Buffers,  Up: Buffers
  462.  
  463. Indirect Buffers
  464. ================
  465.  
  466.    An "indirect buffer" shares the text of some other buffer, which is
  467. called the "base buffer" of the indirect buffer.  In some ways it is
  468. the analogue, for buffers, of a symbolic link among files.  The base
  469. buffer may not itself be an indirect buffer.
  470.  
  471.    The text of the indirect buffer is always identical to the text of
  472. its base buffer; changes made by editing either one are visible
  473. immediately in the other.  This includes the text properties as well as
  474. the characters themselves.
  475.  
  476.    But in all other respects, the indirect buffer and its base buffer
  477. are completely separate.  They have different names, different values of
  478. point, different narrowing, different markers and overlays (though
  479. inserting or deleting text in either buffer relocates the markers and
  480. overlays for both), different major modes, and different local
  481. variables.
  482.  
  483.    An indirect buffer cannot visit a file, but its base buffer can.  If
  484. you try to save the indirect buffer, that actually works by saving the
  485. base buffer.
  486.  
  487.    Killing an indirect buffer has no effect on its base buffer.  Killing
  488. the base buffer effectively kills the indirect buffer in that it cannot
  489. ever again be the current buffer.
  490.  
  491.  - Command: make-indirect-buffer BASE-BUFFER NAME
  492.      This creates an indirect buffer named NAME whose base buffer is
  493.      BASE-BUFFER.  The argument BASE-BUFFER may be a buffer or a string.
  494.  
  495.      If BASE-BUFFER is an indirect buffer, its base buffer is used as
  496.      the base for the new buffer.
  497.  
  498.  - Function: buffer-base-buffer BUFFER
  499.      This function returns the base buffer of BUFFER.  If BUFFER is not
  500.      indirect, the value is `nil'.  Otherwise, the value is another
  501.      buffer, which is never an indirect buffer.
  502.  
  503. 
  504. File: lispref.info,  Node: Windows,  Next: Frames,  Prev: Buffers,  Up: Top
  505.  
  506. Windows
  507. *******
  508.  
  509.    This chapter describes most of the functions and variables related to
  510. Emacs windows.  See *Note Display::, for information on how text is
  511. displayed in windows.
  512.  
  513. * Menu:
  514.  
  515. * Basic Windows::          Basic information on using windows.
  516. * Splitting Windows::      Splitting one window into two windows.
  517. * Deleting Windows::       Deleting a window gives its space to other windows.
  518. * Selecting Windows::      The selected window is the one that you edit in.
  519. * Cyclic Window Ordering:: Moving around the existing windows.
  520. * Buffers and Windows::    Each window displays the contents of a buffer.
  521. * Displaying Buffers::     Higher-lever functions for displaying a buffer
  522.                              and choosing a window for it.
  523. * Choosing Window::       How to choose a window for displaying a buffer.
  524. * Window Point::           Each window has its own location of point.
  525. * Window Start::           The display-start position controls which text
  526.                              is on-screen in the window.
  527. * Vertical Scrolling::     Moving text up and down in the window.
  528. * Horizontal Scrolling::   Moving text sideways on the window.
  529. * Size of Window::         Accessing the size of a window.
  530. * Position of Window::     Accessing the position of a window.
  531. * Resizing Windows::       Changing the size of a window.
  532. * Window Configurations::  Saving and restoring the state of the screen.
  533.  
  534. 
  535. File: lispref.info,  Node: Basic Windows,  Next: Splitting Windows,  Up: Windows
  536.  
  537. Basic Concepts of Emacs Windows
  538. ===============================
  539.  
  540.    A "window" in XEmacs is the physical area of the screen in which a
  541. buffer is displayed.  The term is also used to refer to a Lisp object
  542. that represents that screen area in XEmacs Lisp.  It should be clear
  543. from the context which is meant.
  544.  
  545.    XEmacs groups windows into frames.  A frame represents an area of
  546. screen available for XEmacs to use.  Each frame always contains at least
  547. one window, but you can subdivide it vertically or horizontally into
  548. multiple nonoverlapping Emacs windows.
  549.  
  550.    In each frame, at any time, one and only one window is designated as
  551. "selected within the frame".  The frame's cursor appears in that
  552. window.  At ant time, one frame is the selected frame; and the window
  553. selected within that frame is "the selected window".  The selected
  554. window's buffer is usually the current buffer (except when `set-buffer'
  555. has been used).  *Note Current Buffer::.
  556.  
  557.    For practical purposes, a window exists only while it is displayed in
  558. a frame.  Once removed from the frame, the window is effectively deleted
  559. and should not be used, *even though there may still be references to
  560. it* from other Lisp objects.  Restoring a saved window configuration is
  561. the only way for a window no longer on the screen to come back to life.
  562. (*Note Deleting Windows::.)
  563.  
  564.    Each window has the following attributes:
  565.  
  566.    * containing frame
  567.  
  568.    * window height
  569.  
  570.    * window width
  571.  
  572.    * window edges with respect to the frame or screen
  573.  
  574.    * the buffer it displays
  575.  
  576.    * position within the buffer at the upper left of the window
  577.  
  578.    * amount of horizontal scrolling, in columns
  579.  
  580.    * point
  581.  
  582.    * the mark
  583.  
  584.    * how recently the window was selected
  585.  
  586.    Users create multiple windows so they can look at several buffers at
  587. once.  Lisp libraries use multiple windows for a variety of reasons, but
  588. most often to display related information.  In Rmail, for example, you
  589. can move through a summary buffer in one window while the other window
  590. shows messages one at a time as they are reached.
  591.  
  592.    The meaning of "window" in XEmacs is similar to what it means in the
  593. context of general-purpose window systems such as X, but not identical.
  594. The X Window System places X windows on the screen; XEmacs uses one or
  595. more X windows as frames, and subdivides them into Emacs windows.  When
  596. you use XEmacs on a character-only terminal, XEmacs treats the whole
  597. terminal screen as one frame.
  598.  
  599.    Most window systems support arbitrarily located overlapping windows.
  600. In contrast, Emacs windows are "tiled"; they never overlap, and
  601. together they fill the whole screen or frame.  Because of the way in
  602. which XEmacs creates new windows and resizes them, you can't create
  603. every conceivable tiling of windows on an Emacs frame.  *Note Splitting
  604. Windows::, and *Note Size of Window::.
  605.  
  606.    *Note Display::, for information on how the contents of the window's
  607. buffer are displayed in the window.
  608.  
  609.  - Function: windowp OBJECT
  610.      This function returns `t' if OBJECT is a window.
  611.  
  612. 
  613. File: lispref.info,  Node: Splitting Windows,  Next: Deleting Windows,  Prev: Basic Windows,  Up: Windows
  614.  
  615. Splitting Windows
  616. =================
  617.  
  618.    The functions described here are the primitives used to split a
  619. window into two windows.  Two higher level functions sometimes split a
  620. window, but not always: `pop-to-buffer' and `display-buffer' (*note
  621. Displaying Buffers::.).
  622.  
  623.    The functions described here do not accept a buffer as an argument.
  624. The two "halves" of the split window initially display the same buffer
  625. previously visible in the window that was split.
  626.  
  627.  - Function: one-window-p &optional NO-MINI ALL-FRAMES
  628.      This function returns non-`nil' if there is only one window.  The
  629.      argument NO-MINI, if non-`nil', means don't count the minibuffer
  630.      even if it is active; otherwise, the minibuffer window is
  631.      included, if active, in the total number of windows which is
  632.      compared against one.
  633.  
  634.      The argument ALL-FRAME controls which set of windows are counted.
  635.         * If it is `nil' or omitted, then count only the selected
  636.           frame, plus the minibuffer it uses (which may be on another
  637.           frame).
  638.  
  639.         * If it is `t', then windows on all frames that currently exist
  640.           (including invisible and iconified frames) are counted.
  641.  
  642.         * If it is the symbol `visible', then windows on all visible
  643.           frames are counted.
  644.  
  645.         * If it is the number 0, then windows on all visible and
  646.           iconified frames are counted.
  647.  
  648.         * If it is any other value, then precisely the windows in
  649.           WINDOW's frame are counted, excluding the minibuffer in use
  650.           if it lies in some other frame.
  651.  
  652.  - Command: split-window &optional WINDOW SIZE HORIZONTAL
  653.      This function splits WINDOW into two windows.  The original window
  654.      WINDOW remains the selected window, but occupies only part of its
  655.      former screen area.  The rest is occupied by a newly created
  656.      window which is returned as the value of this function.
  657.  
  658.      If HORIZONTAL is non-`nil', then WINDOW splits into two side by
  659.      side windows.  The original window WINDOW keeps the leftmost SIZE
  660.      columns, and gives the rest of the columns to the new window.
  661.      Otherwise, it splits into windows one above the other, and WINDOW
  662.      keeps the upper SIZE lines and gives the rest of the lines to the
  663.      new window.  The original window is therefore the left-hand or
  664.      upper of the two, and the new window is the right-hand or lower.
  665.  
  666.      If WINDOW is omitted or `nil', then the selected window is split.
  667.      If SIZE is omitted or `nil', then WINDOW is divided evenly into
  668.      two parts.  (If there is an odd line, it is allocated to the new
  669.      window.)  When `split-window' is called interactively, all its
  670.      arguments are `nil'.
  671.  
  672.      The following example starts with one window on a frame that is 50
  673.      lines high by 80 columns wide; then the window is split.
  674.  
  675.           (setq w (selected-window))
  676.                => #<window 8 on windows.texi>
  677.           (window-edges)          ; Edges in order:
  678.                => (0 0 80 50)     ;   left-top-right-bottom
  679.  
  680.           ;; Returns window created
  681.           (setq w2 (split-window w 15))
  682.                => #<window 28 on windows.texi>
  683.  
  684.           (window-edges w2)
  685.                => (0 15 80 50)    ; Bottom window;
  686.                                   ;   top is line 15
  687.  
  688.           (window-edges w)
  689.                => (0 0 80 15)     ; Top window
  690.  
  691.      The frame looks like this:
  692.  
  693.           __________
  694.                   |          |  line 0
  695.                   |    w     |
  696.                   |__________|
  697.                   |          |  line 15
  698.                   |    w2    |
  699.                   |__________|
  700.                                 line 50
  701.            column 0   column 80
  702.  
  703.      Next, the top window is split horizontally:
  704.  
  705.           (setq w3 (split-window w 35 t))
  706.                => #<window 32 on windows.texi>
  707.  
  708.           (window-edges w3)
  709.                => (35 0 80 15)  ; Left edge at column 35
  710.  
  711.           (window-edges w)
  712.                => (0 0 35 15)   ; Right edge at column 35
  713.  
  714.           (window-edges w2)
  715.                => (0 15 80 50)  ; Bottom window unchanged
  716.  
  717.      Now, the screen looks like this:
  718.  
  719.           column 35
  720.                    __________
  721.                   |   |      |  line 0
  722.                   | w |  w3  |
  723.                   |___|______|
  724.                   |          |  line 15
  725.                   |    w2    |
  726.                   |__________|
  727.                                 line 50
  728.            column 0   column 80
  729.  
  730.      Normally, Emacs indicates the border between two side-by-side
  731.      windows with a scroll bar (*note Scroll Bars: X Frame Properties.)
  732.      or `|' characters.  The display table can specify alternative
  733.      border characters; see *Note Display Tables::.
  734.  
  735.  - Command: split-window-vertically &optional SIZE
  736.      This function splits the selected window into two windows, one
  737.      above the other, leaving the selected window with SIZE lines.
  738.  
  739.      This function is simply an interface to `split-windows'.  Here is
  740.      the complete function definition for it:
  741.  
  742.           (defun split-window-vertically (&optional arg)
  743.             "Split current window into two windows, one above the other."
  744.             (interactive "P")
  745.             (split-window nil (and arg (prefix-numeric-value arg))))
  746.  
  747.  - Command: split-window-horizontally &optional SIZE
  748.      This function splits the selected window into two windows
  749.      side-by-side, leaving the selected window with SIZE columns.
  750.  
  751.      This function is simply an interface to `split-windows'.  Here is
  752.      the complete definition for `split-window-horizontally' (except for
  753.      part of the documentation string):
  754.  
  755.           (defun split-window-horizontally (&optional arg)
  756.             "Split selected window into two windows, side by side..."
  757.             (interactive "P")
  758.             (split-window nil (and arg (prefix-numeric-value arg)) t))
  759.  
  760.  - Function: one-window-p &optional NO-MINI ALL-FRAMES
  761.      This function returns non-`nil' if there is only one window.  The
  762.      argument NO-MINI, if non-`nil', means don't count the minibuffer
  763.      even if it is active; otherwise, the minibuffer window is
  764.      included, if active, in the total number of windows, which is
  765.      compared against one.
  766.  
  767.      The argument ALL-FRAMES specifies which frames to consider.  Here
  768.      are the possible values and their meanings:
  769.  
  770.     `nil'
  771.           Count the windows in the selected frame, plus the minibuffer
  772.           used by that frame even if it lies in some other frame.
  773.  
  774.     `t'
  775.           Count all windows in all existing frames.
  776.  
  777.     `visible'
  778.           Count all windows in all visible frames.
  779.  
  780.     0
  781.           Count all windows in all visible or iconified frames.
  782.  
  783.     anything else
  784.           Count precisely the windows in the selected frame, and no
  785.           others.
  786.  
  787. 
  788. File: lispref.info,  Node: Deleting Windows,  Next: Selecting Windows,  Prev: Splitting Windows,  Up: Windows
  789.  
  790. Deleting Windows
  791. ================
  792.  
  793.    A window remains visible on its frame unless you "delete" it by
  794. calling certain functions that delete windows.  A deleted window cannot
  795. appear on the screen, but continues to exist as a Lisp object until
  796. there are no references to it.  There is no way to cancel the deletion
  797. of a window aside from restoring a saved window configuration (*note
  798. Window Configurations::.).  Restoring a window configuration also
  799. deletes any windows that aren't part of that configuration.
  800.  
  801.    When you delete a window, the space it took up is given to one
  802. adjacent sibling.  (In Emacs version 18, the space was divided evenly
  803. among all the siblings.)
  804.  
  805.  - Function: window-live-p WINDOW
  806.      This function returns `nil' if WINDOW is deleted, and `t'
  807.      otherwise.
  808.  
  809.      *Warning:* Erroneous information or fatal errors may result from
  810.      using a deleted window as if it were live.
  811.  
  812.  - Command: delete-window &optional WINDOW
  813.      This function removes WINDOW from the display.  If WINDOW is
  814.      omitted, then the selected window is deleted.  An error is signaled
  815.      if there is only one window when `delete-window' is called.
  816.  
  817.      This function returns `nil'.
  818.  
  819.      When `delete-window' is called interactively, WINDOW defaults to
  820.      the selected window.
  821.  
  822.  - Command: delete-other-windows &optional WINDOW
  823.      This function makes WINDOW the only window on its frame, by
  824.      deleting the other windows in that frame.  If WINDOW is omitted or
  825.      `nil', then the selected window is used by default.
  826.  
  827.      The result is `nil'.
  828.  
  829.  - Command: delete-windows-on BUFFER &optional FRAME
  830.      This function deletes all windows showing BUFFER.  If there are no
  831.      windows showing BUFFER, it does nothing.
  832.  
  833.      `delete-windows-on' operates frame by frame.  If a frame has
  834.      several windows showing different buffers, then those showing
  835.      BUFFER are removed, and the others expand to fill the space.  If
  836.      all windows in some frame are showing BUFFER (including the case
  837.      where there is only one window), then the frame reverts to having a
  838.      single window showing another buffer chosen with `other-buffer'.
  839.      *Note The Buffer List::.
  840.  
  841.      The argument FRAME controls which frames to operate on:
  842.  
  843.         * If it is `nil', operate on the selected frame.
  844.  
  845.         * If it is `t', operate on all frames.
  846.  
  847.         * If it is `visible', operate on all visible frames.
  848.  
  849.         * 0 If it is 0, operate on all visible or iconified frames.
  850.  
  851.         * If it is a frame, operate on that frame.
  852.  
  853.      This function always returns `nil'.
  854.  
  855. 
  856. File: lispref.info,  Node: Selecting Windows,  Next: Cyclic Window Ordering,  Prev: Deleting Windows,  Up: Windows
  857.  
  858. Selecting Windows
  859. =================
  860.  
  861.    When a window is selected, the buffer in the window becomes the
  862. current buffer, and the cursor will appear in it.
  863.  
  864.  - Function: selected-window &optional DEVICE
  865.      This function returns the selected window.  This is the window in
  866.      which the cursor appears and to which many commands apply.  Each
  867.      separate device can have its own selected window, which is
  868.      remembered as focus changes from device to device.  Optional
  869.      argument DEVICE specifies which device to return the selected
  870.      window for, and defaults to the selected device.
  871.  
  872.  - Function: select-window WINDOW
  873.      This function makes WINDOW the selected window.  The cursor then
  874.      appears in WINDOW (on redisplay).  The buffer being displayed in
  875.      WINDOW is immediately designated the current buffer.
  876.  
  877.      The return value is WINDOW.
  878.  
  879.           (setq w (next-window))
  880.           (select-window w)
  881.                => #<window 65 on windows.texi>
  882.  
  883.  - Macro: save-selected-window FORMS...
  884.      This macro records the selected window, executes FORMS in
  885.      sequence, then restores the earlier selected window.  It does not
  886.      save or restore anything about the sizes, arrangement or contents
  887.      of windows; therefore, if the FORMS change them, the changes are
  888.      permanent.
  889.  
  890.    The following functions choose one of the windows on the screen,
  891. offering various criteria for the choice.
  892.  
  893.  - Function: get-lru-window &optional FRAME
  894.      This function returns the window least recently "used" (that is,
  895.      selected).  The selected window is always the most recently used
  896.      window.
  897.  
  898.      The selected window can be the least recently used window if it is
  899.      the only window.  A newly created window becomes the least
  900.      recently used window until it is selected.  A minibuffer window is
  901.      never a candidate.
  902.  
  903.      The argument FRAME controls which windows are considered.
  904.  
  905.         * If it is `nil', consider windows on the selected frame.
  906.  
  907.         * If it is `t', consider windows on all frames.
  908.  
  909.         * If it is `visible', consider windows on all visible frames.
  910.  
  911.         * If it is 0, consider windows on all visible or iconified
  912.           frames.
  913.  
  914.         * If it is a frame, consider windows on that frame.
  915.  
  916.  - Function: get-largest-window &optional FRAME
  917.      This function returns the window with the largest area (height
  918.      times width).  If there are no side-by-side windows, then this is
  919.      the window with the most lines.  A minibuffer window is never a
  920.      candidate.
  921.  
  922.      If there are two windows of the same size, then the function
  923.      returns the window that is first in the cyclic ordering of windows
  924.      (see following section), starting from the selected window.
  925.  
  926.      The argument FRAME controls which set of windows are considered.
  927.      See `get-lru-window', above.
  928.  
  929. 
  930. File: lispref.info,  Node: Cyclic Window Ordering,  Next: Buffers and Windows,  Prev: Selecting Windows,  Up: Windows
  931.  
  932. Cyclic Ordering of Windows
  933. ==========================
  934.  
  935.    When you use the command `C-x o' (`other-window') to select the next
  936. window, it moves through all the windows on the screen in a specific
  937. cyclic order.  For any given configuration of windows, this order never
  938. varies.  It is called the "cyclic ordering of windows".
  939.  
  940.    This ordering generally goes from top to bottom, and from left to
  941. right.  But it may go down first or go right first, depending on the
  942. order in which the windows were split.
  943.  
  944.    If the first split was vertical (into windows one above each other),
  945. and then the subwindows were split horizontally, then the ordering is
  946. left to right in the top of the frame, and then left to right in the
  947. next lower part of the frame, and so on.  If the first split was
  948. horizontal, the ordering is top to bottom in the left part, and so on.
  949. In general, within each set of siblings at any level in the window tree,
  950. the order is left to right, or top to bottom.
  951.  
  952.  - Function: next-window &optional WINDOW MINIBUF ALL-FRAMES
  953.      This function returns the window following WINDOW in the cyclic
  954.      ordering of windows.  This is the window that `C-x o' would select
  955.      if typed when WINDOW is selected.  If WINDOW is the only window
  956.      visible, then this function returns WINDOW.  If omitted, WINDOW
  957.      defaults to the selected window.
  958.  
  959.      The value of the argument MINIBUF determines whether the
  960.      minibuffer is included in the window order.  Normally, when
  961.      MINIBUF is `nil', the minibuffer is included if it is currently
  962.      active; this is the behavior of `C-x o'.  (The minibuffer window
  963.      is active while the minibuffer is in use.  *Note Minibuffers::.)
  964.  
  965.      If MINIBUF is `t', then the cyclic ordering includes the
  966.      minibuffer window even if it is not active.
  967.  
  968.      If MINIBUF is neither `t' nor `nil', then the minibuffer window is
  969.      not included even if it is active.
  970.  
  971.      The argument ALL-FRAMES specifies which frames to consider.  Here
  972.      are the possible values and their meanings:
  973.  
  974.     `nil'
  975.           Consider all the windows in WINDOW's frame, plus the
  976.           minibuffer used by that frame even if it lies in some other
  977.           frame.
  978.  
  979.     `t'
  980.           Consider all windows in all existing frames.
  981.  
  982.     `visible'
  983.           Consider all windows in all visible frames.  (To get useful
  984.           results, you must ensure WINDOW is in a visible frame.)
  985.  
  986.     0
  987.           Consider all windows in all visible or iconified frames.
  988.  
  989.     anything else
  990.           Consider precisely the windows in WINDOW's frame, and no
  991.           others.
  992.  
  993.      This example assumes there are two windows, both displaying the
  994.      buffer `windows.texi':
  995.  
  996.           (selected-window)
  997.                => #<window 56 on windows.texi>
  998.           (next-window (selected-window))
  999.                => #<window 52 on windows.texi>
  1000.           (next-window (next-window (selected-window)))
  1001.                => #<window 56 on windows.texi>
  1002.  
  1003.  - Function: previous-window &optional WINDOW MINIBUF ALL-FRAMES
  1004.      This function returns the window preceding WINDOW in the cyclic
  1005.      ordering of windows.  The other arguments specify which windows to
  1006.      include in the cycle, as in `next-window'.
  1007.  
  1008.  - Command: other-window COUNT &optional FRAME
  1009.      This function selects the COUNTth following window in the cyclic
  1010.      order.  If count is negative, then it selects the -COUNTth
  1011.      preceding window.  It returns `nil'.
  1012.  
  1013.      In an interactive call, COUNT is the numeric prefix argument.
  1014.  
  1015.      The argument FRAME controls which set of windows are considered.
  1016.         * If it is `nil' or omitted, then windows on the selected frame
  1017.           are considered.
  1018.  
  1019.         * If it is a frame, then windows on that frame are considered.
  1020.  
  1021.         * If it is `t', then windows on all frames that currently exist
  1022.           (including invisible and iconified frames) are considered.
  1023.  
  1024.         * If it is the symbol `visible', then windows on all visible
  1025.           frames are considered.
  1026.  
  1027.         * If it is the number 0, then windows on all visible and
  1028.           iconified frames are considered.
  1029.  
  1030.         * If it is any other value, then the behavior is undefined.
  1031.  
  1032.  - Function: walk-windows PROC &optional MINIBUF ALL-FRAMES
  1033.      This function cycles through all windows, calling `proc' once for
  1034.      each window with the window as its sole argument.
  1035.  
  1036.      The optional arguments MINIBUF and ALL-FRAMES specify the set of
  1037.      windows to include in the scan.  See `next-window', above, for
  1038.      details.
  1039.  
  1040. 
  1041. File: lispref.info,  Node: Buffers and Windows,  Next: Displaying Buffers,  Prev: Cyclic Window Ordering,  Up: Windows
  1042.  
  1043. Buffers and Windows
  1044. ===================
  1045.  
  1046.    This section describes low-level functions to examine windows or to
  1047. display buffers in windows in a precisely controlled fashion.  *Note
  1048. Displaying Buffers::, for related functions that find a window to use
  1049. and specify a buffer for it.  The functions described there are easier
  1050. to use than these, but they employ heuristics in choosing or creating a
  1051. window; use these functions when you need complete control.
  1052.  
  1053.  - Function: set-window-buffer WINDOW BUFFER-OR-NAME
  1054.      This function makes WINDOW display BUFFER-OR-NAME as its contents.
  1055.      It returns `nil'.
  1056.  
  1057.           (set-window-buffer (selected-window) "foo")
  1058.                => nil
  1059.  
  1060.  - Function: window-buffer &optional WINDOW
  1061.      This function returns the buffer that WINDOW is displaying.  If
  1062.      WINDOW is omitted, this function returns the buffer for the
  1063.      selected window.
  1064.  
  1065.           (window-buffer)
  1066.                => #<buffer windows.texi>
  1067.  
  1068.  - Function: get-buffer-window BUFFER-OR-NAME &optional FRAME
  1069.      This function returns a window currently displaying
  1070.      BUFFER-OR-NAME, or `nil' if there is none.  If there are several
  1071.      such windows, then the function returns the first one in the
  1072.      cyclic ordering of windows, starting from the selected window.
  1073.      *Note Cyclic Window Ordering::.
  1074.  
  1075.      The argument ALL-FRAMES controls which windows to consider.
  1076.  
  1077.         * If it is `nil', consider windows on the selected frame.
  1078.  
  1079.         * If it is `t', consider windows on all frames.
  1080.  
  1081.         * If it is `visible', consider windows on all visible frames.
  1082.  
  1083.         * If it is 0, consider windows on all visible or iconified
  1084.           frames.
  1085.  
  1086.         * If it is a frame, consider windows on that frame.
  1087.  
  1088. 
  1089. File: lispref.info,  Node: Displaying Buffers,  Next: Choosing Window,  Prev: Buffers and Windows,  Up: Windows
  1090.  
  1091. Displaying Buffers in Windows
  1092. =============================
  1093.  
  1094.    In this section we describe convenient functions that choose a window
  1095. automatically and use it to display a specified buffer.  These functions
  1096. can also split an existing window in certain circumstances.  We also
  1097. describe variables that parameterize the heuristics used for choosing a
  1098. window.  *Note Buffers and Windows::, for low-level functions that give
  1099. you more precise control.
  1100.  
  1101.    Do not use the functions in this section in order to make a buffer
  1102. current so that a Lisp program can access or modify it; they are too
  1103. drastic for that purpose, since they change the display of buffers in
  1104. windows, which is gratuitous and will surprise the user.  Instead, use
  1105. `set-buffer' (*note Current Buffer::.) and `save-excursion' (*note
  1106. Excursions::.), which designate buffers as current for programmed
  1107. access without affecting the display of buffers in windows.
  1108.  
  1109.  - Command: switch-to-buffer BUFFER-OR-NAME &optional NORECORD
  1110.      This function makes BUFFER-OR-NAME the current buffer, and also
  1111.      displays the buffer in the selected window.  This means that a
  1112.      human can see the buffer and subsequent keyboard commands will
  1113.      apply to it.  Contrast this with `set-buffer', which makes
  1114.      BUFFER-OR-NAME the current buffer but does not display it in the
  1115.      selected window.  *Note Current Buffer::.
  1116.  
  1117.      If BUFFER-OR-NAME does not identify an existing buffer, then a new
  1118.      buffer by that name is created.  The major mode for the new buffer
  1119.      is set according to the variable `default-major-mode'.  *Note Auto
  1120.      Major Mode::.
  1121.  
  1122.      Normally the specified buffer is put at the front of the buffer
  1123.      list.  This affects the operation of `other-buffer'.  However, if
  1124.      NORECORD is non-`nil', this is not done.  *Note The Buffer List::.
  1125.  
  1126.      The `switch-to-buffer' function is often used interactively, as
  1127.      the binding of `C-x b'.  It is also used frequently in programs.
  1128.      It always returns `nil'.
  1129.  
  1130.  - Command: switch-to-buffer-other-window BUFFER-OR-NAME
  1131.      This function makes BUFFER-OR-NAME the current buffer and displays
  1132.      it in a window not currently selected.  It then selects that
  1133.      window.  The handling of the buffer is the same as in
  1134.      `switch-to-buffer'.
  1135.  
  1136.      The currently selected window is absolutely never used to do the
  1137.      job.  If it is the only window, then it is split to make a
  1138.      distinct window for this purpose.  If the selected window is
  1139.      already displaying the buffer, then it continues to do so, but
  1140.      another window is nonetheless found to display it in as well.
  1141.  
  1142.  - Function: pop-to-buffer BUFFER-OR-NAME &optional OTHER-WINDOW
  1143.           ON-FRAME
  1144.      This function makes BUFFER-OR-NAME the current buffer and switches
  1145.      to it in some window, preferably not the window previously
  1146.      selected.  The "popped-to" window becomes the selected window
  1147.      within its frame.
  1148.  
  1149.      If the variable `pop-up-frames' is non-`nil', `pop-to-buffer'
  1150.      looks for a window in any visible frame already displaying the
  1151.      buffer; if there is one, it returns that window and makes it be
  1152.      selected within its frame.  If there is none, it creates a new
  1153.      frame and displays the buffer in it.
  1154.  
  1155.      If `pop-up-frames' is `nil', then `pop-to-buffer' operates
  1156.      entirely within the selected frame.  (If the selected frame has
  1157.      just a minibuffer, `pop-to-buffer' operates within the most
  1158.      recently selected frame that was not just a minibuffer.)
  1159.  
  1160.      If the variable `pop-up-windows' is non-`nil', windows may be
  1161.      split to create a new window that is different from the original
  1162.      window.  For details, see *Note Choosing Window::.
  1163.  
  1164.      If OTHER-WINDOW is non-`nil', `pop-to-buffer' finds or creates
  1165.      another window even if BUFFER-OR-NAME is already visible in the
  1166.      selected window.  Thus BUFFER-OR-NAME could end up displayed in
  1167.      two windows.  On the other hand, if BUFFER-OR-NAME is already
  1168.      displayed in the selected window and OTHER-WINDOW is `nil', then
  1169.      the selected window is considered sufficient display for
  1170.      BUFFER-OR-NAME, so that nothing needs to be done.
  1171.  
  1172.      All the variables that affect `display-buffer' affect
  1173.      `pop-to-buffer' as well.  *Note Choosing Window::.
  1174.  
  1175.      If BUFFER-OR-NAME is a string that does not name an existing
  1176.      buffer, a buffer by that name is created.  The major mode for the
  1177.      new buffer is set according to the variable `default-major-mode'.
  1178.      *Note Auto Major Mode::.
  1179.  
  1180.      If ON-FRAME is non-`nil', it is the frame to pop to this buffer on.
  1181.  
  1182.      An example use of this function is found at the end of *Note
  1183.      Filter Functions::.
  1184.  
  1185.  - Command: replace-buffer-in-windows BUFFER
  1186.      This function replaces BUFFER with some other buffer in all
  1187.      windows displaying it.  The other buffer used is chosen with
  1188.      `other-buffer'.  In the usual applications of this function, you
  1189.      don't care which other buffer is used; you just want to make sure
  1190.      that BUFFER is no longer displayed.
  1191.  
  1192.      This function returns `nil'.
  1193.  
  1194.